local hx__shenjian = fk.CreateSkill {
  name = "hx__shenjian",
  tags = { Skill.Compulsory, },
}

hx__shenjian:addEffect(fk.Damage, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(hx__shenjian.name) and player == target and data.to ~= player and not data.to.dead and data.to:getMark("@hx__shenjian_tianjie") < 3
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:addPlayerMark(data.to, "@hx__shenjian_tianjie")
  end,
})
hx__shenjian:addEffect(fk.TurnEnd, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(hx__shenjian.name) and target:getMark("@hx__shenjian_tianjie") == 3
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(target, "@hx__shenjian_tianjie", 0)
    room:damage{
      from = player,
      to = target,
      damage = 2,
      damageType = fk.ThunderDamage,
      skillName = hx__shenjian.name,
    }
  end,
})

return hx__shenjian